package day14homework;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class TcpServer {
    public static void main(String[] args) throws IOException {
        ServerSocket server = new ServerSocket(8080);

        Socket socket = server.accept();
        InputStream in = socket.getInputStream();

        byte[] bytes = new byte[1024];
        int len = in.read(bytes);

        String str = new String(bytes);
        System.out.println(str);

        socket.close();
        server.close();
    }
}
